package com.zx.cloud.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zx.cloud.ApiVersion;
import com.zx.cloud.controller.client.ConsultationClient;
import com.zx.cloud.domain.Consultation;
import com.zx.cloud.model.response.ObjectDataResponse;
import com.zx.cloud.util.Page;

import io.swagger.annotations.ApiOperation;

/**
 * @author Alex
 */
@RestController
@RequestMapping(value = ApiVersion.MANAGER_V1_PREFIX + "/consultation", produces = { MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
public class ConsultationController {

	@Autowired
	private ConsultationClient consultationClient;

	// 查看公告表内容
	@ApiOperation(value = "查看公告表内容" , notes = "查看公告表内容")
	@RequestMapping(value = "queryConsultation", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<Page<Consultation>> queryConsultation(@RequestBody Consultation consultation) {
		ObjectDataResponse<Page<Consultation>> datas = consultationClient.queryConsultation(consultation);
		return datas;
	}
	
	// 修改公告信息

	@ApiOperation(value = "修改公告表内容" , notes = "修改公告表内容")
	@RequestMapping(value = "updateConsultation", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<Integer> updateConsultation(@RequestBody Consultation consultation) {
		ObjectDataResponse<Integer> success = consultationClient.updateConsultation(consultation);
		return success;
	}

	// 添加公告信息

	@ApiOperation(value = "添加公告表内容" , notes = "添加公告表内容")
	@RequestMapping(value = "addConsultation", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<Integer> addConsultation(@RequestBody Consultation consultation) {
		ObjectDataResponse<Integer> success = consultationClient.addConsultation(consultation);
		return success;
	}

    //删除
		@ApiOperation(value = "删除公告表内容" , notes = "删除公告表内容")
		@RequestMapping(value = "deleteConsultation", method = RequestMethod.POST)
		@ResponseBody
		public ObjectDataResponse<Integer> deleteConsultation(@RequestBody Consultation consultation) {
			ObjectDataResponse<Integer> success = consultationClient.deleteConsultation(consultation);

			return success;
		}
	

}
